package com.shuoyue.ycgk.ui.questionbank.note;

import androidx.annotation.Nullable;

import com.chad.library.adapter.base.BaseViewHolder;
import com.shuoyue.ycgk.R;
import com.shuoyue.ycgk.base.baseadapter.AppBaseQuickAdapter;
import com.shuoyue.ycgk.entity.QuestionNote;
import com.shuoyue.ycgk.utils.GlideUtil;
import com.shuoyue.ycgk.utils.XDateUtils;

import java.util.List;

public class NoteAdapter extends AppBaseQuickAdapter<QuestionNote> {
    public NoteAdapter(@Nullable List<QuestionNote> data) {
        super(R.layout.item_note, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, QuestionNote item) {
        helper.addOnClickListener(R.id.lay_praise);
        helper.setText(R.id.name, item.getUsername());
        helper.setText(R.id.content, item.getNotes());
        helper.setText(R.id.time, item.getCreateTime());
        helper.setText(R.id.praiseNum, String.valueOf(item.getLikeCount()));
        helper.setImageResource(R.id.img_praise, item.getIsLike() == 1 ?
                R.mipmap.icon_raise_y : R.mipmap.icon_raise_n);
        GlideUtil.loadImageCircular(mContext, item.getAvatar(), R.mipmap.index_head, helper.getView(R.id.head));
    }
}
